﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Markup;
using System.Windows.Data;
using System.Windows.Media;

namespace WpfClient.Classes
{
    public class ColorConverter : MarkupExtension, IValueConverter
    {
        public ColorConverter()
        {
        }

        #region IValueConverter Members

        public object Convert(object value, System.Type targetType,
                    object parameter, System.Globalization.CultureInfo culture)
        {
            if ((bool)value == true)
                return new LinearGradientBrush(
                        Color.FromArgb(100, 255, 0, 0),
                        Color.FromArgb(0, 255, 0, 0), 0);
            else
                return Brushes.White;
        }

        public object ConvertBack(object value, System.Type targetType,
                    object parameter, System.Globalization.CultureInfo culture)
        {
            throw new System.NotImplementedException();
        }

        #endregion

        public override object ProvideValue(System.IServiceProvider serviceProvider)
        {
            return this;
        }
    }
}
